# -*- coding: latin-1 -*-

from django.conf.urls.defaults import patterns, include

from django import conf

UV_REGEX = r'(?P<uv>[A-Z0-9]+)'
DEPARTEMENT_REGEX = r'(?P<departement>[A-Za-z]+)'
FILIERE_REGEX = r'(?P<filiere>[A-Za-z0-9]+)'
APP_ID_REGEX = r'(?P<app_id>[0-9]+)'

urlpatterns = patterns(
  'critic.views',
  (r'^$', 'index'),
  (r'^login/$', 'login'),
  (r'^logout/$', 'logout'),
  (r'^account/$', 'account'),
  (r'^dept/%s/$' % DEPARTEMENT_REGEX, 'course_list'),
  (r'^uv/%s/$' % UV_REGEX, 'course_detail'),
  (r'^uv/%s/eval(?:/%s)?/$' % (UV_REGEX, APP_ID_REGEX), 'course_eval_entry'),
  (r'^cleanup/(%s/)?$' % UV_REGEX, 'clean_uv'),
  (r'^export/csv/$', 'export_csv'),
  (r'^finduv/$', 'course_finder'),
   )

if conf.settings.DEBUG:
  urlpatterns += patterns('',
    (r'^site_media/(?P<path>.*)$',
     'django.views.static.serve',
     {'document_root': conf.settings.MEDIA_ROOT}),
   )
